package ui.views.property;

import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertySource;
import org.eclipse.ui.views.properties.PropertyDescriptor;
import org.eclipse.ui.views.properties.TextPropertyDescriptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import util.*;
import dao.*;
public class MarketVariableProp implements IPropertySource{
	private final static Logger logger = LoggerFactory.getLogger(MarketVariableProp.class);

	private EgnMarketVari mv;

	public MarketVariableProp() {

	}
	public MarketVariableProp(EgnMarketVari element) {
		this.mv =element;
	}

	public Object getEditableValue() {
		return this;
	}

	public IPropertyDescriptor[] getPropertyDescriptors() {
//		logger.debug("start PropertyDesc");
		TextPropertyDescriptor mvIdDesce = new TextPropertyDescriptor(mv.getMvId(), "01.Id");
		TextPropertyDescriptor mvTypeDesc = new TextPropertyDescriptor(mv.getMvType(), "02.Type");
//		TextPropertyDescriptor sceDesc = new TextPropertyDescriptor(mv.g, "02.mvName");
//		TextPropertyDescriptor mvDesc = new TextPropertyDescriptor(mv.getMarketVari(), "03.MarketVariable");
//		PropertyDescriptor coefficientDesc = new PropertyDescriptor(mv.getPrimaryValue(), "04.Coefficient");

		mvIdDesce.setCategory("Label");
		mvTypeDesc.setCategory("Label");
//		sceDesc.setCategory("Label");

		IPropertyDescriptor[] propDesc = new IPropertyDescriptor[] {
				mvIdDesce
				,mvTypeDesc
//				, mvDesc
//				,coefficientDesc
				};

		return propDesc;
	}

	public Object getPropertyValue(Object property) {
		if (mv.getMvId().equals(property)) return mv.getMvId();
		else if (mv.getMvType().equals(property)) return mv.getMvType();

//		else if (mv.getEtyName().equals(property)) return mv.getEtyName();
//		else if (sce.getMarketVari().equals(property)) return sce.getMarketVari();
//		else if (((Double)mv.getPrimaryValue()).equals(property)) return mv.getPrimaryValue();

		return null;
	}

	public void setPropertyValue(Object id, Object value) {
//		if (sce.getSceSetId().equals(id)) sce.setSceSetId((String)value);
//		else if (sce.getSceId().equals(id)) sce.setSceId((String)value);
//		else if (sce.getMarketVari().equals(id)) sce.getMarketVari((String)value);
	}

	public boolean isPropertySet(Object id) {
		return false;
	}

	public void resetPropertyValue(Object id) {
	}

}
